<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:atsm="http://www.atsm.vn/taglib"
	xmlns:a4j="http://richfaces.org/a4j">

	<atsm:rModelPanel rModelPanelId="#{idModalPanel}">
		<f:facet name="header">
			<h:outputText value="Create New Flight" />
		</f:facet>

		<ui:remove>
			<!-- Content panel -->
		</ui:remove>

		<atsm:hForm hFormId="form_#{idModalPanel}">
			<h:panelGrid columns="2">
				<h:outputText value="#{flightmsgs['fromCity']}" />
				<h:selectOneMenu id="cbCityFrom" value="#{bean.selectedCityFrom}"
					immediate="true">
					<a4j:support action="#{bean.onChangeCityFrom}" event="onchange" reRender="cbCityTo"/>
					<f:selectItems value="#{newFlight.cityFroms}" />
				</h:selectOneMenu>
				<h:outputText value="#{flightmsgs['toCity']}" />
				<h:selectOneMenu value="#{bean.selectedFlightLine}"
					id="cbCityTo">
					<f:selectItems value="#{bean.cityToes}" />
				</h:selectOneMenu>
				<h:outputText value="#{flightmsgs['plane']}" />
				<h:selectOneMenu value="#{bean.selectedPlane}"
					onchange="submit()"
					valueChangeListener="#{bean.planeValueChanged}"
					immediate="true">
					<f:selectItems value="#{bean.planes}" />
				</h:selectOneMenu>
				<h:outputText value="#{flightmsgs['departDate']}" />
				<rich:calendar id="calDepartDate" required="true"
					value="#{bean.selectedDepartDate}" popup="true"
					datePattern="d/M/yy HH:mm">
					<f:convertDateTime pattern="d/M/yy HH:mm" />
				</rich:calendar>

				<h:outputText value="#{flightmsgs['arriveDate']}" />
				<rich:calendar id="calArriveDate" required="true"
					value="#{bean.selectedArriveDate}" popup="true"
					datePattern="d/M/yy HH:mm">
					<f:convertDateTime pattern="d/M/yy HH:mm" />
				</rich:calendar>
			</h:panelGrid>
			<h:panelGrid>
				<a4j:commandButton id="save" value="Save" style="float:left; "
					ajaxSingle="true" action="#{bean.doSave(idModalPanel)}" 
					reRender="#{idModalPanel}"
					onclick="Atsm.Mask.show();" oncomplete="Atsm.Mask.hide();" />
			</h:panelGrid>
		</atsm:hForm>
	</atsm:rModelPanel>
</ui:composition>
